package com.itlong.cloud.property.dao;

import com.itlong.cloud.POJO.PO.FeeRuleInfoPO;
import com.itlong.cloud.POJO.PO.LadderFeeInfoPO;
import com.itlong.cloud.POJO.PO.PropertyPaymentBillPO;
import com.itlong.cloud.POJO.PO.RoomInfoPO;
import com.itlong.cloud.POJO.VO.property.PropertyGetManagementPageVO;
import com.itlong.cloud.POJO.VO.property.PropertyPaymentGetPageCostsVO;
import com.itlong.cloud.POJO.VO.property.PropertyPaymentGetPageVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;

/**
 * <desc>
 *      物业收费管理数据访问接口
 * </desc>
 *
 * @createDate 2018/08/13
 */
@Mapper
@Repository
public interface IPropertyPaymentManageDao {

    /**
     * <desc>
     *      保存缴费录入数据
     * </desc>
     *
     * @param params 数据参数
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/15
     */
    Integer save(Map<String, Object> params);


    /**
     * <desc>
     *      查询抄表分页数据
     * </desc>
     *
     * @param params
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/15
     */
    List<PropertyPaymentGetPageVO> getMeterMainPage(Map<String,Object> params);

    /**
     * <desc>
     *      查询抄表分页数据总条数
     * </desc>
     *
     * @param params
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/15
     */
    Integer getMeterMainPageCount(Map<String,Object> params);

    /**
     * <desc>
     *      查询物业费分页数据
     * </desc>
     *
     * @param params
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/20
     */
    List<PropertyGetManagementPageVO> getManagementPage(Map<String,Object> params);

    /**
     * <desc>
     *      查询物业费分页数据总条数
     * </desc>
     *
     * @param params
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/20
     */
     Integer getManagementPageCount(Map<String,Object> params);

    /**
     * <desc>
     *      获取抄表账单详细数据
     * </desc>
     *
     * @param params
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/15
     */
    List<PropertyPaymentGetPageCostsVO> getMeterSubList(Map<String,Object> params);

    /**
     * <desc>
     *      根据日期查询当前账单单号
     * </desc>
     *
     * @param date
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/17
     */
    String getFeeNumberByDate(@Param("date")String date,@Param("projectId") String projectId);

    /**
     * <desc>
     *      根据feeId查询账单
     * </desc>
     *
     * @param feeId
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/17
     */
    PropertyPaymentBillPO getBillByFeeId(@Param("feeId") String feeId);

    /**
     * <desc>
     *      根据房间id及时间查询是否已生成账单
     * </desc>
     *
     * @param roomId
     * @param month
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/17
     */
    PropertyPaymentBillPO getBillByRoomIdAndMonth(@Param("roomId") String roomId,@Param("month") String month);

    /**
     * <desc>
     *      根据规则id获取规则
     * </desc>
     *
     * @param feeRuleId
     * @return
     * @authro Jiaqi.X
     * @createDate 2018/08/17
     */
    FeeRuleInfoPO getRuleInfoByRuleId(@Param("feeRuleId") String feeRuleId);

    /**
     * <desc>
     *      根据规则名称获取规则
     * </desc>
     *
     * @param ruleName
     * @param projectId
     * @return
     * @authro Jiaqi.X
     * @createDate 2018/08/17
     */
    FeeRuleInfoPO getRuleInfoByRuleName(@Param("ruleName") String ruleName,@Param("projectId") String projectId);

    /**
     * <desc>
     *      根据规则id获取阶梯收费规则
     * </desc>
     *
     * @param ruleId
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/17
     */
    List<LadderFeeInfoPO> getLaddersByRuleId(@Param("ruleId") String ruleId);

    /**
     * <desc>
     *      修改数据
     * </desc>
     *
     * @param params 数据参数
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/17
     */
    Integer update(Map<String,Object> params);

    /**
     * <desc>
     *      删除账单
     * </desc>
     *
     * @param feeId
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/21
     */
    Integer deleteBillByFeeId(@Param("feeId")String feeId);

    /**
     * <desc>
     *      查询房间的面积信息
     * </desc>
     *
     * @param roomId
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/21
     */
    Map<String,String> getRoomAreaByRoomId(@Param("roomId") String roomId);

    /**
     * <desc>
     *      查询楼栋下的房间信息，且当月没有生成录入数据的房间
     * </desc>
     *
     * @param strBuildIds
     * @param month
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/22
     */
    List<RoomInfoPO> getRoomsByBuildIdsAndMonth(@Param("buildIds")String[] strBuildIds,
                                                @Param("month") String month,
                                                @Param("type") Integer type);

    /**
     * <desc>
     *      查询当月是否生成过账单
     * </desc>
     *
     * @param roomId    房间id
     * @param month     月份
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/27
     */
    Integer checkCurrentMonthHaveBill(@Param("roomId") String roomId,@Param("month") String month,@Param("endTime") String endTime);

    /**
     * <desc>
     *      查询单月是否已录入物业费数据
     * </desc>
     *
     * @param roomId
     * @param month
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/28
     */
    Integer checkCurrentMonthHavePropertyFee(@Param("roomId") String roomId,@Param("month") String month,@Param("endTime") String endTime);

    /**
     * <desc>
     *      根据楼栋名称、单元名称、房间号 查询房间信息
     * </desc>
     *
     * @param buildName
     * @param unitName
     * @param roomNum
     * @return
     * @auhtor Jiaqi.X
     * @createDate 2018/08/30
     */
    Map<String,Object> getRoomInfoByBuildNameAndUnitNameAndRoomNum(@Param("buildName") String buildName,
                                                                         @Param("unitName") String unitName,
                                                                         @Param("roomNum")String roomNum,
                                                                         @Param("projectId") String projectId);

    /**
     * <desc>
     *      根据规则名称查询规则
     * </desc>
     *
     * @param projectId
     * @param ruleName
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/30
     */
    String getRuleIdByRuleName(@Param("projectId") String projectId,@Param("ruleName") String ruleName,@Param("type") Integer type);

    /**
     * <desc>
     *      根据房间id查询住户手机号
     * </desc>
     *
     * @param roomId
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/31
     */
    Map<String,Object> getUserPhoneByRoomId(@Param("roomId") String roomId);

    /**
     * <desc>
     *      根据房间id查询所有住户手机号
     * </desc>
     *
     * @param roomId
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/31
     */
    List<String> getUserPhonesByRoomId(@Param("roomId") String roomId);

    /**
     * <desc>
     *      检测房间是否存在住户
     * </desc>
     *
     * @param roomId
     * @return
     * @author Jiaqi.X
     * @createDate 2018/09/03
     */
    Integer checkRoomHaveOwner(@Param("roomId") String roomId);

    /**
     * <desc>
     *      查询收费规则的收费周期
     * </desc>
     *
     * @param feeRuleId
     * @return
     * @author Jiaqi.X
     * @createDate 2018/09/03
     */
    Integer getRuleCycle(@Param("feeRuleId") String feeRuleId);

    /**
     * <desc>
     *      检测房间面积是否为空
     * </desc>
     *
     * @param roomId
     * @return
     * @author Jiaqi.X
     * @createDate 2018/10/23
     */
    Integer checkRoomArea(@Param("roomId") String roomId);

    /**
     * <desc>
     *      通过项目id查询项目名
     * </desc>
     *
     * @param projectId
     * @return
     * @author Jiaqi.X
     * @createDate 2018/10/26
     */
    String getProjectNameByProjectId(@Param("projectId") String projectId);

    /**
     * <desc>
     *      检测房间是否在临时通行中
     * </desc>
     *
     * @param roomId
     * @return
     * @author Jiaqi.X
     * @createDate 2019/07/01
     */
    Integer checkRoomInfoIsTempPass(@Param("roomId") String roomId);

    /**
     * <desc>
     *      检测房间是否解除限制
     * </desc>
     *
     * @param roomId
     * @return
     * @author Jiaqi.X
     * @createDate 2019/07/01
     */
    Integer checkRoomInfoIsTempRemove(@Param("roomId") String roomId);

    /**
     * <desc>
     *      修改房间的欠费状态
     * </desc>
     *
     * @param roomId
     * @return
     * @author Jiaqi.X
     * @createDate 2019/07/01
     */
    Integer updateRoomStatus(@Param("roomId") String roomId);

    /**
     * <desc>
     *      获取房间欠费的用户信息
     * </desc>
     *
     * @param roomId
     * @return
     * @author Jiaqi.X
     * @createDate 2019/07/01
     */
    List<Map<String,Object>> getArrearRoomUserIds(@Param("roomId") String roomId);

    /**
     * <desc>
     *      修改用户的项目状态
     * </desc>
     *
     * @param user
     * @return
     * @author Jiaqi.X
     * @createDate 2019/07/01
     */
    Integer updateUserProjectStatus(Map<String,Object> user);

    /**
     * <desc>
     *      修改物业费的备注信息
     * </desc>
     *
     * @param feeDataId
     * @param remark
     * @return
     * @author Jiaqi.X
     * @creatDate 2019/07/10
     */
    Integer updatePropertyFeeRemark(@Param("feeDataId") String feeDataId,@Param("remark") String remark);

    /**
     * <desc>
     *      根据feeDataId查询是否已创建账单
     * </desc>
     *
     * @param feeDataId
     * @return
     * @author Jiaqi.X
     * @createDate 2019/07/15
     */
    String getFeeIdByFeeDataId(@Param("feeDataId") String feeDataId);
}
